#ifndef _H_MEZZA_SDATE_
#define _H_MEZZA_SDATE_

/* Uma string que representa uma data deve ser como nos exemplos:

    DD/MM/YYYY
        21/08/1980
    MM/DD/YYYY
        08/21/1980

    São 10 caracteres.
*/
#define SDATE_STR_LEN   	10
#define SDATE_YEAR_MAXLIMIT	3000	

enum mz_sdate_fmt { DD_MM_YYYY=1000, MM_DD_YYYY };

typedef struct _mz_simple_date {
    unsigned char   day;
    unsigned char   month;
    unsigned short  year;
} mz_sdate_t;

int mz_sdate_to_string(char *dest, enum mz_sdate_fmt format, const mz_sdate_t* const date);

int mz_sdate_from_string(const char *src, enum mz_sdate_fmt format, mz_sdate_t *date);

int mz_sdate_cmp(const mz_sdate_t* const date1, const mz_sdate_t* const date2);

int mz_sdate_is_leapyear(int year);

int mz_sdate_month_ndays(int year, int month, int *ndays);

int mz_sdate_diff(const mz_sdate_t* const date1, const mz_sdate_t* const date2);

void mz_sdate_swap(mz_sdate_t *date1, mz_sdate_t *date2);

int mz_sdate_validate(const mz_sdate_t* const date1);

#endif /* _H_MEZZA_SDATE_ */
